package cn.school.mybatis.ano;

import java.lang.reflect.Method;

public class CalcTest {

	public static void main(String[] args) throws Exception, SecurityException {
		Calc c = new Calc();
		// System.out.println(c.add(4, 5));
		// 反射
		Method madd = c.getClass().getDeclaredMethod("add", int.class, int.class);
		if (madd.isAnnotationPresent(MyTest.class)) {
			MyTest test = madd.getAnnotation(MyTest.class);
			System.out.println(test.before());
			Object o = madd.invoke(c, 14, 5);
			System.out.println("结果是" + o);
			System.out.println(test.after());
		} else {
			Object o = madd.invoke(c, 14, 5);
			System.out.println("结果是" + o);
		}
		System.out.println("注解 is over");
	}

}
